import request from '@/utils/request/request';

import {
  APIAccessLogParams,
  APIAccessLogListRes,
} from '@/api/system/model/apiAccessLogModel';
import requestForFile from '@/utils/request/requestForFile';

// 分页查询API访问日志列表
export function queryAPIAccessLogRecordList(params: APIAccessLogParams) {
  return request.get<APIAccessLogListRes>('/api/infra/api-access-log/page', {
    params,
  });
}

// 导出到Excel
export function exportDataToExcel() {
  // 文件导出接口要用专门的requestForFile，且要求responseType为blob才行
  return requestForFile.get('/api/infra/api-access-log/export-excel', {
    responseType: 'blob',
  });
}
